package com.bank.controller;

import com.alibaba.fastjson.JSON;
import com.bank.model.Assets;
import com.bank.model.Transaction;
import com.bank.service.InfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
public class TransactionController {

    @Autowired
    InfoService infoService;

    @RequestMapping(value = "/allTransactions",method = RequestMethod.POST)
    public String verify(@RequestBody Map<String,String> map) {
        Map<String,Object> ret = new HashMap<>();
        ret.put("code","200");
        ret.put("msg","");
        List<Transaction> list = infoService.getAllTransactionList(map.get("uid"));
        Collections.sort(list);
        ret.put("data",list);
        return JSON.toJSONString(ret);
    }


}
